home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / XLisp-Stat / Functions / randomgen.lsp < prev    next >
Lisp/Scheme  |  1990-10-11  |  192b  |  10 lines

  1. ; book pp.102-103
  2.  
  3. (defun make-generator (a m x0)
  4.   (let ((x x0))
  5.     #'(lambda ()
  6.         (setf x (rem (* a x) m))
  7.         (/ x m))))
  8.  
  9. (def g (make-generator (^ 7. 5) (- (^ 2. 31) 1) 12345))
  10.